﻿using DapperExtensions.Mapper;
using Newtonsoft.Json;

namespace ZilLion.Service.WeChatMall.Domain.Entitys.Cust
{
    public class CustAddressEntity
    {
        /// <summary>
        ///     custid  顾客id
        /// </summary>
        [JsonProperty("custid")]
        public long Custid { get; set; }

        /// <summary>
        ///     dzid cpk 地址id
        /// </summary>
        [JsonProperty("dzid")]
        public long AddressId { get; set; }

        /// <summary>
        ///     sex 性别：1-男，2-女
        /// </summary>
        [JsonProperty("sex")]
        public short Sex { get; set; }

        /// <summary>
        ///     jdwd 经度,纬度
        /// </summary>
        [JsonProperty("location")]
        public string Location { get; set; }

        /// <summary>
        ///     所在城市省份证前缀
        /// </summary>
        [JsonProperty("adcode")]
        public string Adcode { get; set; }


        /// <summary>
        ///     address 地标地址（地图定位地址）
        /// </summary>
        [JsonProperty("gpsaddress")]
        public string GpsAddress { get; set; }

        /// <summary>
        ///     shaddress 送货地址(用户手输的详细地址)
        /// </summary>
        [JsonProperty("detailaddress")]
        public string DetailAddress { get; set; }

        /// <summary>
        ///     defaultaddr 是否默认地址：1-是
        /// </summary>
        [JsonProperty("isdefault")]
        public short IsDefault { get; set; }

        /// <summary>
        ///     shr  收货人
        /// </summary>
        [JsonProperty("receiver")]
        public string Receiver { get; set; }

        /// <summary>
        ///     shrphonenum 收货电话
        /// </summary>
        [JsonProperty("receivertel")]
        public string ReceiverTel { get; set; }
    }


    public class CustAddressEntityMapper : ClassMapper<CustAddressEntity>
    {
        public CustAddressEntityMapper()
        {
            Table("weisccustjfaddr");
            Map(f => f.Custid).Column("custid");
            Map(f => f.AddressId).Column("dzid").Key(KeyType.Assigned);
            Map(f => f.Sex).Column("sex");
            Map(f => f.Location).Column("jdwd");
            Map(f => f.Adcode).Column("cscode");
            Map(f => f.GpsAddress).Column("address");
            Map(f => f.DetailAddress).Column("shaddress");
            Map(f => f.IsDefault).Column("defaultaddr");
            Map(f => f.Receiver).Column("shr");
            Map(f => f.ReceiverTel).Column("shrphonenum");
        }
    }
}